﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true"
    CodeFile="AlbumEdit.aspx.cs" Inherits="Admin_Modules_Phote_AlbumEdit" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="c" runat="Server">  <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div class="wrap">
        <div id="icon-edit" class="icon32 icon32-posts-post">
            <br />
        </div>
        <h2>Add/Edit Album</h2>
        <div id="wpbody-content">
            <table class="form-table">
                <tbody>
                    <tr class="form-field form-required">
                        <th scope="row" valign="top">
                            <label for="name">
                                Name</label>
                        </th>
                        <td>
                            <%--<input name="name" id="name" type="text" value="" size="40" aria-required="true">--%>
                            <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ControlToValidate="txtName" ID="rname" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>
                            <p class="description">
                                The name is how it appears on your site.
                            </p>
                        </td>
                    </tr>
                    <tr class="form-field">
                        <th scope="row" valign="top">
                            <label for="slug">
                                Slug</label>
                        </th>
                        <td>
                            <asp:TextBox ID="txtSlug" runat="server"></asp:TextBox>
                            <%--<asp:RequiredFieldValidator ControlToValidate="txtSlug" ID="rslug" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>--%>
                            <p class="description">
                                The “slug” is the URL-friendly version of the name. It is usually all lowercase
                                and contains only letters, numbers, and hyphens.
                            </p>
                        </td>
                    </tr>
                    <tr class="form-field">
                            <th scope="row" valign="top">
                            <label for="slug">
                                Image</label>
                        </th>
                        <td>
                        <div style="width: 80px; height: 80px; border: solid thin orange;">
                            <asp:Image ID="imgThumb" runat="server" EnableViewState="true" AlternateText="Ảnh đại diện"
                                ToolTip="Ảnh đại diện tour" Width="80px" Height="80px" />
                            <asp:HiddenField ID="hdfimg" runat="server" />
                        </div>
                        <div>
                            <telerik:DialogOpener runat="server" ID="DialogOpener1"></telerik:DialogOpener>
                            <input type="button" id="btnSelectThumb" value="Chọn" style="width: 40px;" onclick="selectThumb()" />
                            <input type="button" id="btnClearThumb" value="Xóa" style="width: 40px;" onclick="clearThumb()" />
                        </div></td>
                    </tr>
                </tbody>
            </table>
            <p class="submit">
                <%--<input type="submit" name="submit" id="submit" class="button-primary" value="Update">--%>
                <asp:Button ID="btnUpdate" runat="server" CssClass="button-primary"
                    Text="Update" OnClick="btnUpdate_Click" />
                <asp:Label ID="lblError" runat="server" ForeColor="Red"></asp:Label>
            </p>
        </div>
    </div>
    <script type="text/javascript">
        function selectThumb() {
            var radEditorContent = $find("<%= DialogOpener1.ClientID %>");
            radEditorContent.openUrl("/Admin/Modules/FileManager/InsertFTPImage.aspx", {}, 800, 600, selectThumbComplete, null, "custom link manager", true);
        }

        function clearThumb() {
            $('#<%= imgThumb.ClientID %>').attr("scr", "");
            $('#<%= hdfimg.ClientID %>').val("");
        }
        var selectThumbComplete = function (sender, args) {
            if (!args.IsCancel) {
                if (args.Url.length > 0) {
                    var img = document.getElementById("<%= imgThumb.ClientID %>");
            img.src = args.Url;
            $('#<%= hdfimg.ClientID %>').val(args.Url);
            // alert($('#<%= hdfimg.ClientID %>').val());

        }
    }
}
    </script>
</asp:Content>
